# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=myjwt
_pkgname=MyJWT
pkgver=2.1.0.r1.gd2f4c8a
_pyver=3.13
pkgrel=1
epoch=1
pkgdesc='This cli is for pentesters, CTF players, or dev. You can modify your jwt, sign, inject, etc.'
arch=('any')
groups=('blackarch' 'blackarch-exploitation' 'blackarch-cracker')
url='https://github.com/mBouamama/MyJWT'
license=('MIT')
depends=('python' 'python-click' 'python-cryptography' 'python-pyopenssl'
         'python-requests' 'python-questionary' 'python-aiocmd' 'exrex'
         'python-pyperclip')
makedepends=('git' 'python-setuptools')
source=("git+https://github.com/mBouamama/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $_pkgname

  python setup.py build
}

package() {
  cd $_pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf "$pkgdir/usr/lib/python$_pyver/site-packages/tests"
}

